﻿#region License
// (c) Garry McGlennon 2009
// 
// This project is made available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty – Use at your own risk
// 
// View the project and the latest code at http://dnpframework.codeplex.com/
// 
// All other rights reserved.
// 
// blog: www.dotNetProfessional.com/blog/
#endregion
namespace dnp.DomainModeler
{
    public class MappedProperty
    {
        private readonly string _name;
        private readonly PropertyCollection _properties = new PropertyCollection();


        public MappedProperty(string name)
        {
            _name = name;
        }

        public MappedProperty(string name, Property mapping)
        {
            _name = name;
            this.Properties.Add(mapping);
        }

        public string Name
        {
            get { return _name; }
        }

        public PropertyCollection Properties
        {
            get { return _properties; }
        }

        public Property RelatedPrimaryKey
        {
            get
            {
                return this.Properties[0].Parent.PrimaryKey.Properties[0];
            }
        }
    }
}
